home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / comp / subtract.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  835 b   |  36 lines

  1. /*
  2.                             S U B T R A C T . C
  3. */
  4.  
  5. #include "iccomp.h"
  6.  
  7. ESTRUC_ *subtract (lval, rval)
  8.     ESTRUC_
  9.         *lval,
  10.         *rval;
  11. {
  12.     register E_TYPE_
  13.         type;
  14.  
  15.     if (test_binop(op_sub, lval, rval))
  16.         return (lval);                      /* test for correct types */
  17.  
  18.     btoi(lval);                             /* convert pending booleans */
  19.     btoi(rval);
  20.  
  21.     if (conflict(lval, rval, op_sub))       /* test type conflict */
  22.         return(lval);
  23.  
  24.     type = lval->type;                      /* remember the type */
  25.  
  26.     if ((lval->type & rval->type & ~ALLTYPES) == e_const)
  27.         lval->evalue -= rval->evalue;
  28.     else
  29.     {
  30.         defcode(lval, rval, op_sub);
  31.         set_type(lval, type & (ALLTYPES | e_code));
  32.     }
  33.  
  34.     return (lval);                          /* return new expression */
  35. }
  36.